import React, { Component } from 'react'
import { connect } from 'react-redux'
import { createAddMsg } from '../../redux/actions/count_action'
class Demo extends Component {
    add = () => {
        this.props.jiasi(4)
    }
    render() {
        return (
            <div>
                <button onClick={this.add}>加4</button>
                <ul>
                    {
                        this.props.he.map((v) => {
                            return <li key={v.id}>{v.name}---{v.age}</li>
                        })
                    }
                </ul>
            </div>
        )
    }
}
export default connect(
    //映射状态
    state => ({ he: state.rens }),
    // 映射状态的方法
    { jiasi: createAddMsg }
)(Demo)
